For each video, six regions of interest (roi) are considered. Three for each subject (patient and therapist): head, torso and legs. The exploratory analysis is done in two parts:

  1. In the first part, we look for 5 minutes segments with high lagged correlation for some roi.
  2. In the second part, we look for 30 second periods with high movement of both subjects. Cross correlations are performed and visualized for those high movement periods.

First part.

Basic information of the 26 videos is registered in table bitacora. Here we show the top entries of this table.

file sampling_rate id_paciente date corte_inicial corte_final paciente terapeuta
Vid0 30 1 24/04/2012 0 0 Enrique:TNP Iván
Vid5 30 1 01/05/2012 0 0 Enrique:TNP Iván
Vid6 30 1 03/05/2012 0 0 Enrique:TNP Iván
Vid7Inv 30 1 14/03/2013 0 0 Enrique:TNP Iván
Vid8Inv 30 1 19/03/2013 0 0 Enrique:TNP Iván

The list completa contains the data for each of the videos listed in bitacora. As an example, completa[[‘Vid5’]] is a data set with 86084 observations. At a sampling rate of 30 frames per second, this corresponds to 47.82 minutes for the video Vid5. Its first entries are shown below.

Top entries for Vid5 raw data.
tiempo cabeza_paciente torso_paciente piernas_paciente cabeza_terapeuta torso_terapeuta piernas_terapeuta
1 14447 16605 5333 33111 47080 75432
2 2850 13 759 5036 5272 10237
3 1229 6 276 3761 5864 9211
4 70 7 0 4622 7795 19966
5 49 52 0 11452 19099 37113
6 81 61 0 17414 20704 38285
7 32 27 0 13582 14550 28746
8 213 15 0 8707 10282 30627
9 416 2 0 6804 19605 36326
10 665 15 0 9098 20439 34309

The code below generates the database lista_seleccionados. This contains information on segments where high correlation (with time lags) between the movements of the subjects is detected. Each of the videos in bitacora is partiotioned in 5 minutes segments. For each segment and roi, cross correlations (wuth 3 seconds max-lags in both directions) between therapist and subject movements are performed; the maximum and the mean values for the correlations for all the lags are recorded; if either the max>0.7 or mean>0.3 the segment is added to the list. If the maximum correlation corresponds to lag 0, the segment is discarded (simultaneous movement), since the correlation in this case is most likely due to external noise.

lista_seleccionados<-data.frame(matrix(ncol = 10,nrow = 0))

for (video in names(completa)){
      temp <- crear_lista(partition_data(completa[[video]]),
                          nombre = video,umbral_max = 0.7,umbral_mean = 0.5)
      names(lista_seleccionados)<-names(temp)
      lista_seleccionados<-rbind(lista_seleccionados,temp)
}

lista_seleccionados<-cbind(id=1:dim(lista_seleccionados)[1],lista_seleccionados)
lista_seleccionados<-filter(lista_seleccionados,abs(lag_spearman_max)>0.025)

write.csv(lista_seleccionados,"lista_seleccionados.csv",row.names = FALSE)
Five minute segments with high lagged correlation. Lags are shown in seconds, with positive values corresponding to lags where the therapist leads.
id video zona num_periodo minuto_inicio minuto_final acf_max acf_promedio lag_acf_max spearman_max lag_spearman_max
1 Vid9Inv piernas 2 5 10 0.7778175 0.0839720 0.17 0.7038933 0.03
3 Vid23 cabeza 2 5 10 0.6714752 0.1590583 -0.07 0.5980951 -0.17
6 Vid23 cabeza 6 25 30 0.5133773 0.2191590 0.00 0.7069990 0.20
7 Vid23 cabeza 7 30 35 0.5595110 0.2521709 0.03 0.7510832 0.13
8 Vid26 cabeza 1 0 5 0.5724400 0.2348001 -3.43 0.6900542 -4.73
9 Vid26 torso 1 0 5 0.3751576 0.2114076 -3.30 0.7863391 -5.00

We include two functions functions comparativa_visual and corr_cruzadas for visualizing the data of the segments with high correlation. The fundamental input for both functions is the number in the id column of lista_seleccionados.

## function (id, min_ini = 0, min_fin = 100, que_lista = lista_seleccionados) 
## {
##     temp <- corta_lista(id, ls = que_lista)[[1]]
##     temp2 <- corta_lista(id, ls = que_lista)
##     g <- ggplot() + geom_line(data = filter(temp, tiempo > min_ini, 
##         tiempo < min_fin), aes(tiempo, suave_paciente), color = "blue", 
##         size = 0.5) + geom_line(data = filter(temp, tiempo > 
##         min_ini, tiempo < min_fin), aes(tiempo, suave_terapeuta), 
##         color = "brown", size = 0.5) + ggtitle(temp2[["video"]]) + 
##         xlab("minuto en el video") + ylab("Azul: paciente. Rojo: terapeuta. (Promedios por segundo)")
##     show(g)
##     return(g)
## }
## function (id, que_lista = lista_seleccionados) 
## {
##     temp <- corta_lista(id, ls = que_lista)[[1]]
##     cecefe <- ccf(rank(temp$suave_paciente), rank(temp$suave_terapeuta), 
##         plot = FALSE, lag.max = 150)
##     aux <- data.frame(segundos = cecefe$lag[, 1, 1]/30, correlacion = cecefe$acf[, 
##         1, 1])
##     temp2 <- corta_lista(id, ls = que_lista)
##     g <- ggplot(aux, aes(segundos, correlacion)) + geom_col(color = "orange", 
##         fill = "purple") + ggtitle(paste(temp2[["video"]], temp2[["minutos"]], 
##         sep = "                 ")) + xlab("lidera paciente       <--   segundos de desface   -->       lidera terapeuta") + 
##         ylab("correlaciones cruzadas")
##     show(g)
##     return(g)
## }

The function comparativa_visual returns a plot that shows the movement of both therapist and patient for the corresponding segment and roi. We generate below the plots generated by this function for all the 6 segments with high correlation.

The function corr_cruzadas shows the cross correlation between movements of both subjects at lags of up to 3 seconds (in both directions). The plots are generated below.

With the function comparativa_visual we can zoom in to look into shorter periods of time. As an example, we generate the plot of the first segment (id=1) from minute 7.1 to minute 8.6:

comparativa_visual(id=1,min_ini = 7.1,min_fin = 8.6)

Part 2: exploring short lapses with high movement.

Videos are partitioned into 120 second segments. The mean amounts of movement for each roi are calculated (as recorded by the MEA software). If the means of both the therapist and patient are in the top 15 quantile, the corresponding data for that roi and time is registered in the list lista_mov_altos.

Below, we show the database lista_mov_altos containing 169 segments having high mobility for both subjects. Cross correlations were evaluated and registered for each of these segments. To determine which subject is leading, the sign og the lag with maximum correlation is considered (positive when therapist leads).

id video zona num_periodo minuto_inicio minuto_final mov_paciente mov_terapeuta mov_medio acf_max lag_acf_max spearman_max lag_spearman_max lidera se_mueve_mas
1 Vid0 cabeza 1 0.0 0.5 1375.293889 1069.56544 1222.42967 0.5473603 -1.03 0.4386816 -5.00 paciente paciente
2 Vid0 cabeza 64 31.5 32.0 1445.232556 437.32848 941.28052 -0.0066973 1.27 0.4034435 1.67 terapeuta paciente
3 Vid0 cabeza 76 37.5 38.0 1307.471667 345.46667 826.46917 0.0097707 -2.77 0.1687731 -1.17 paciente paciente
4 Vid0 piernas 1 0.0 0.5 1457.674704 2689.57489 2073.62480 0.6876814 -0.87 0.4892809 -5.00 paciente terapeuta
5 Vid0 piernas 23 11.0 11.5 683.904148 800.64948 742.27681 0.6490033 -0.63 0.6353140 -0.60 paciente terapeuta
6 Vid5 cabeza 1 0.0 0.5 2201.400815 1303.49259 1752.44670 0.1963207 -5.00 0.1763822 -5.00 paciente paciente
7 Vid5 cabeza 72 35.5 36.0 441.378704 96.36063 268.86967 0.4129840 4.17 0.4688178 3.07 terapeuta paciente
8 Vid5 torso 1 0.0 0.5 2235.221148 3506.09778 2870.65946 0.1395421 5.00 0.1321238 0.13 terapeuta terapeuta
9 Vid5 torso 78 38.5 39.0 873.130148 906.00270 889.56643 0.5234440 3.63 0.3547179 4.00 terapeuta -
10 Vid5 piernas 1 0.0 0.5 773.771296 2912.84841 1843.30985 0.6121733 0.00 0.1747536 -5.00 paciente terapeuta
11 Vid5 piernas 16 7.5 8.0 105.477889 199.87685 152.67737 0.0618115 -4.67 0.2721609 -4.77 paciente terapeuta
12 Vid6 cabeza 1 0.0 0.5 329.220185 378.30663 353.76341 0.7795188 0.00 0.6444864 -1.40 paciente terapeuta
13 Vid6 cabeza 33 16.0 16.5 1388.765037 794.86856 1091.81680 0.5056995 -3.00 0.2959691 2.20 terapeuta paciente
14 Vid6 cabeza 54 26.5 27.0 297.303444 307.47896 302.39120 0.1993639 -4.37 0.3981212 -4.17 paciente -
15 Vid6 torso 33 16.0 16.5 1198.864482 638.08774 918.47611 0.5012647 2.53 0.3958703 1.87 terapeuta paciente
16 Vid6 torso 54 26.5 27.0 667.987630 292.78537 480.38650 0.0811637 -2.53 0.2757818 -3.77 paciente paciente
17 Vid6 piernas 1 0.0 0.5 483.482370 671.59270 577.53754 0.7748365 -1.43 0.7921382 0.77 terapeuta terapeuta
18 Vid6 piernas 33 16.0 16.5 313.801556 789.05185 551.42670 0.2816275 2.43 -0.0056312 -5.00 paciente terapeuta
19 Vid6 piernas 53 26.0 26.5 407.092889 270.54556 338.81922 0.9828260 2.63 0.1676185 3.83 terapeuta paciente
20 Vid7Inv cabeza 1 0.0 0.5 1020.256111 560.28541 790.27076 0.7865605 0.00 0.7178422 0.83 terapeuta paciente
21 Vid7Inv cabeza 34 16.5 17.0 656.157037 149.39430 402.77567 0.1581794 3.23 -0.0617614 -4.73 paciente paciente
22 Vid7Inv torso 1 0.0 0.5 1080.291296 519.22981 799.76056 0.7747629 0.37 0.6419393 3.67 terapeuta paciente
23 Vid7Inv torso 93 46.0 46.5 717.361148 301.89230 509.62672 0.1397739 -4.43 0.5599328 -3.20 paciente paciente
24 Vid7Inv piernas 1 0.0 0.5 1294.801111 1047.33556 1171.06833 0.7964487 -0.47 0.5742937 -0.90 paciente paciente
25 Vid7Inv piernas 37 18.0 18.5 465.759074 151.89222 308.82565 0.8166740 0.17 0.7965507 0.13 terapeuta paciente
26 Vid7Inv piernas 93 46.0 46.5 562.672852 142.82044 352.74665 0.2154304 -4.27 0.3164254 -2.57 paciente paciente
27 Vid8Inv cabeza 1 0.0 0.5 654.822704 210.92285 432.87278 0.7559293 -4.63 0.6292249 -2.63 paciente paciente
28 Vid8Inv cabeza 48 23.5 24.0 351.742519 68.36167 210.05209 0.3459767 -4.10 0.0994991 -5.00 paciente paciente
29 Vid8Inv torso 67 33.0 33.5 1182.426889 149.96363 666.19526 0.4853294 2.67 0.4752111 1.13 terapeuta paciente
30 Vid8Inv torso 89 44.0 44.5 1388.734074 191.46741 790.10074 0.6889490 3.10 0.4147437 3.43 terapeuta paciente
31 Vid8Inv piernas 69 34.0 34.5 144.143037 130.76337 137.45320 0.1769258 5.00 0.2574611 3.80 terapeuta paciente
32 Vid9Inv cabeza 1 0.0 0.5 1090.876037 302.09500 696.48552 0.6925089 -3.67 0.3536394 -2.57 paciente paciente
33 Vid9Inv cabeza 97 48.0 48.5 634.344148 166.49433 400.41924 0.6847504 3.40 0.2970961 2.77 terapeuta paciente
34 Vid9Inv torso 1 0.0 0.5 1275.955852 495.58589 885.77087 0.7709192 -3.07 0.4736712 -3.73 paciente paciente
35 Vid9Inv torso 79 39.0 39.5 868.344741 456.38348 662.36411 0.1690233 -3.07 0.2873269 -5.00 paciente paciente
36 Vid9Inv torso 97 48.0 48.5 1170.942111 380.10104 775.52157 0.8377903 3.30 0.0002153 2.90 terapeuta paciente
37 Vid9Inv piernas 1 0.0 0.5 648.720556 813.90011 731.31033 0.8021734 -1.70 0.7731040 -1.27 paciente terapeuta
38 Vid9Inv piernas 54 26.5 27.0 104.964037 138.99330 121.97867 0.2918023 3.30 0.3809617 5.00 terapeuta terapeuta
39 Vid9Inv piernas 74 36.5 37.0 346.353185 503.20796 424.78057 -0.0652561 0.00 0.0311370 3.70 terapeuta terapeuta
40 Vid9Inv piernas 81 40.0 40.5 82.761815 203.29393 143.02787 0.7128838 4.97 0.5304428 3.87 terapeuta terapeuta
41 Vid10Inv cabeza 1 0.0 0.5 1151.350074 493.27800 822.31404 0.7235364 -4.03 0.6016384 -0.67 paciente paciente
42 Vid10Inv cabeza 55 27.0 27.5 571.011222 259.90293 415.45707 0.0452153 4.37 0.1628810 -4.97 paciente paciente
43 Vid10Inv cabeza 67 33.0 33.5 397.924444 197.58437 297.75441 0.2029579 -1.93 0.0747715 3.77 terapeuta paciente
44 Vid10Inv cabeza 88 43.5 44.0 765.732926 172.77311 469.25302 0.3814521 1.43 0.5589878 3.10 terapeuta paciente
45 Vid10Inv piernas 45 22.0 22.5 190.704444 623.98093 407.34269 0.0471067 -5.00 0.1538079 -2.83 paciente terapeuta
46 Vid11Inv cabeza 56 27.5 28.0 255.059741 318.55807 286.80891 0.6359598 0.00 0.3936773 5.00 terapeuta terapeuta
47 Vid11Inv cabeza 76 37.5 38.0 215.799407 211.82181 213.81061 0.0157523 2.27 0.1023253 -0.80 paciente -
48 Vid11Inv cabeza 83 41.0 41.5 525.065852 632.75500 578.91043 0.3902197 5.00 0.1838893 5.00 terapeuta terapeuta
49 Vid11Inv torso 56 27.5 28.0 1114.551889 1034.52941 1074.54065 0.3869409 -2.93 0.3512927 4.57 terapeuta -
50 Vid11Inv torso 83 41.0 41.5 1341.831963 950.94689 1146.38943 0.7867902 -0.47 0.0276424 0.83 terapeuta paciente
51 Vid11Inv piernas 1 0.0 0.5 573.270889 2058.19356 1315.73222 0.7271902 0.00 0.5785272 0.27 terapeuta terapeuta
52 Vid12 cabeza 1 0.0 0.5 126.915333 984.72689 555.82111 0.7545810 -0.23 0.4218313 -0.93 paciente terapeuta
53 Vid12 cabeza 18 8.5 9.0 330.510370 746.36856 538.43946 0.7654338 -5.00 0.5101568 -5.00 paciente terapeuta
54 Vid12 torso 18 8.5 9.0 305.765815 2157.15426 1231.46004 0.6924341 -5.00 0.5870991 -3.47 paciente terapeuta
55 Vid12 piernas 1 0.0 0.5 37.965926 1012.26119 525.11356 0.8793607 0.00 0.6192249 -0.97 paciente terapeuta
56 Vid12 piernas 18 8.5 9.0 117.892333 846.97978 482.43606 0.6729417 -5.00 0.6456340 -3.63 paciente terapeuta
57 Vid13 cabeza 49 24.0 24.5 611.120074 490.05848 550.58928 0.2681934 -2.43 0.3638770 0.93 terapeuta paciente
58 Vid13 cabeza 50 24.5 25.0 680.484556 745.31681 712.90069 0.2068352 2.27 0.3829904 2.67 terapeuta -
59 Vid13 piernas 32 15.5 16.0 140.720000 527.69756 334.20878 -0.0359353 3.67 0.0407033 -4.23 paciente terapeuta
60 Vid14 cabeza 67 33.0 33.5 283.857000 517.97833 400.91767 0.2765724 -0.37 0.2792356 -0.67 paciente terapeuta
61 Vid14 cabeza 80 39.5 40.0 659.353852 2452.54970 1555.95178 0.7267545 1.47 0.5916151 -2.63 paciente terapeuta
62 Vid14 torso 80 39.5 40.0 2734.104111 6577.85074 4655.97743 0.7383573 1.37 0.7405043 -0.57 paciente terapeuta
63 Vid14 piernas 15 7.0 7.5 33.801815 135.27911 84.54046 -0.0599842 5.00 0.2236419 5.00 terapeuta terapeuta
64 Vid14 piernas 80 39.5 40.0 291.021630 2289.58878 1290.30520 0.7596830 1.60 0.7962094 1.27 terapeuta terapeuta
65 Vid15 cabeza 1 0.0 0.5 321.801185 1530.02074 925.91096 0.7612496 -2.90 0.5021473 -4.13 paciente terapeuta
66 Vid15 cabeza 2 0.5 1.0 241.784000 420.93389 331.35894 0.5753308 -1.73 0.6525549 -0.90 paciente terapeuta
67 Vid15 cabeza 19 9.0 9.5 366.433963 618.68970 492.56183 0.1734797 1.17 0.2413494 -3.60 paciente terapeuta
68 Vid15 torso 19 9.0 9.5 1298.529296 1697.41989 1497.97459 -0.0260488 4.00 -0.0208847 -5.00 paciente terapeuta
69 Vid15 piernas 1 0.0 0.5 180.985519 1325.15885 753.07219 0.8590265 -3.40 0.7179767 -3.97 paciente terapeuta
70 Vid16 torso 67 33.0 33.5 1791.765556 2689.17544 2240.47050 0.6139705 2.33 0.3639540 -0.77 paciente terapeuta
71 Vid16 piernas 1 0.0 0.5 59.584778 642.75400 351.16939 0.2782288 4.43 0.4530030 1.80 terapeuta terapeuta
72 Vid16 piernas 53 26.0 26.5 63.303741 597.02111 330.16243 0.5342608 -0.13 0.3828707 0.13 terapeuta terapeuta
73 Vid17 cabeza 26 12.5 13.0 444.550519 814.30952 629.43002 0.1585626 5.00 0.1755575 5.00 terapeuta terapeuta
74 Vid17 torso 26 12.5 13.0 1564.225111 2389.63089 1976.92800 0.3325956 5.00 0.3469943 5.00 terapeuta terapeuta
75 Vid17 torso 27 13.0 13.5 1153.422556 1899.45774 1526.44015 0.2146266 -2.13 0.2203052 -1.27 paciente terapeuta
76 Vid18 cabeza 1 0.0 0.5 163.515148 1565.49307 864.50411 0.5591843 -1.67 0.4266093 -2.10 paciente terapeuta
77 Vid18 cabeza 58 28.5 29.0 148.903185 508.03819 328.47069 0.0279377 5.00 -0.1689495 5.00 terapeuta terapeuta
78 Vid18 torso 58 28.5 29.0 56.322222 1414.39174 735.35698 0.0042980 5.00 0.2716540 5.00 terapeuta terapeuta
79 Vid18 piernas 1 0.0 0.5 116.784111 2074.43411 1095.60911 0.6582309 -3.10 0.7217883 -3.53 paciente terapeuta
80 Vid18 piernas 41 20.0 20.5 196.167852 150.25737 173.21261 0.1328735 -2.80 0.0667656 -3.23 paciente paciente
81 Vid18 piernas 54 26.5 27.0 195.167407 374.04800 284.60770 0.0189024 -5.00 0.1114222 -5.00 paciente terapeuta
82 Vid18 piernas 58 28.5 29.0 101.326667 994.51663 547.92165 -0.0332709 -5.00 0.1596193 3.67 terapeuta terapeuta
83 Vid19 cabeza 1 0.0 0.5 292.603704 929.60211 611.10291 0.5182718 -3.67 0.5171189 -3.37 paciente terapeuta
84 Vid19 cabeza 64 31.5 32.0 307.439111 577.52711 442.48311 -0.0308855 -5.00 -0.0370156 -5.00 paciente terapeuta
85 Vid19 cabeza 72 35.5 36.0 223.284556 696.18559 459.73507 0.2380573 5.00 0.1842822 4.83 terapeuta terapeuta
86 Vid19 torso 67 33.0 33.5 1121.624407 1576.02622 1348.82531 0.4706238 0.43 0.4795882 3.70 terapeuta terapeuta
87 Vid19 piernas 23 11.0 11.5 174.383407 713.60037 443.99189 0.8678707 0.00 0.7633028 -0.77 paciente terapeuta
88 Vid19 piernas 67 33.0 33.5 104.718667 744.00044 424.35956 0.4580774 1.13 0.3940438 4.07 terapeuta terapeuta
89 Vid20 cabeza 33 16.0 16.5 733.537482 413.43659 573.48704 0.1183335 -0.13 0.2290699 -1.23 paciente paciente
90 Vid20 torso 33 16.0 16.5 1807.696667 1536.60200 1672.14933 0.3495477 -1.03 0.2727664 0.17 terapeuta paciente
91 Vid20 piernas 28 13.5 14.0 133.063259 405.98048 269.52187 0.2276933 -4.50 0.2849655 1.37 terapeuta terapeuta
92 Vid21 cabeza 1 0.0 0.5 355.870778 1772.18648 1064.02863 0.6669359 -1.57 0.3903402 -1.63 paciente terapeuta
93 Vid21 cabeza 2 0.5 1.0 337.050185 527.00789 432.02904 0.9410165 0.43 0.1596922 -5.00 paciente terapeuta
94 Vid21 torso 1 0.0 0.5 974.992741 2958.44326 1966.71800 0.8172952 -2.33 0.4728781 0.77 terapeuta terapeuta
95 Vid21 torso 10 4.5 5.0 531.301000 893.08004 712.19052 0.4484035 1.87 0.4245743 -2.97 paciente terapeuta
96 Vid21 torso 66 32.5 33.0 582.771037 754.96541 668.86822 -0.0683450 5.00 -0.2206762 5.00 terapeuta terapeuta
97 Vid21 torso 67 33.0 33.5 413.870185 1956.48781 1185.17900 -0.0221886 4.93 -0.2477209 5.00 terapeuta terapeuta
98 Vid21 piernas 1 0.0 0.5 531.831741 743.58141 637.70657 0.6035943 -2.30 0.4179234 0.60 terapeuta terapeuta
99 Vid21 piernas 35 17.0 17.5 129.780704 297.22937 213.50504 0.2340042 1.43 0.1203015 5.00 terapeuta terapeuta
100 Vid22 cabeza 2 0.5 1.0 23.770889 412.59652 218.18370 0.3501324 -2.23 0.1376222 -0.27 paciente terapeuta
101 Vid22 cabeza 23 11.0 11.5 35.136185 224.91263 130.02441 0.6027557 -0.87 0.1071771 -3.07 paciente terapeuta
102 Vid22 piernas 1 0.0 0.5 131.066148 3114.30504 1622.68559 0.5893778 -1.43 0.5257241 -0.50 paciente terapeuta
103 Vid22 piernas 12 5.5 6.0 22.385259 336.52700 179.45613 0.7787735 -0.10 0.3212429 -4.87 paciente terapeuta
104 Vid22 piernas 37 18.0 18.5 27.929333 75.10770 51.51852 -0.0064647 1.93 -0.0095729 5.00 terapeuta terapeuta
105 Vid23 cabeza 1 0.0 0.5 1434.158333 770.94215 1102.55024 0.8553270 -2.23 0.7292100 -0.37 paciente paciente
106 Vid23 cabeza 53 26.0 26.5 464.197333 754.13548 609.16641 0.5552065 1.43 0.7083969 -0.13 paciente terapeuta
107 Vid23 cabeza 61 30.0 30.5 117.484259 969.05037 543.26731 0.7984723 -0.13 0.6143080 0.20 terapeuta terapeuta
108 Vid23 cabeza 69 34.0 34.5 234.024296 725.68604 479.85517 0.5212858 0.00 0.6938348 0.27 terapeuta terapeuta
109 Vid23 cabeza 71 35.0 35.5 267.869444 805.54230 536.70587 0.5140189 -4.27 0.5472556 0.27 terapeuta terapeuta
110 Vid23 cabeza 78 38.5 39.0 117.111407 778.64474 447.87807 0.2884106 0.00 0.5609643 0.13 terapeuta terapeuta
111 Vid23 torso 84 41.5 42.0 522.583444 311.63504 417.10924 0.1224973 0.73 0.3897589 0.93 terapeuta paciente
112 Vid23 piernas 1 0.0 0.5 150.189000 371.04726 260.61813 0.8732553 0.00 0.4562295 -1.23 paciente terapeuta
113 Vid23 piernas 5 2.0 2.5 15.800185 62.44874 39.12446 0.7463294 -4.97 0.4064018 0.13 terapeuta terapeuta
114 Vid23 piernas 8 3.5 4.0 30.188407 294.35863 162.27352 0.9379113 -0.27 0.5614869 -0.13 paciente terapeuta
115 Vid23 piernas 75 37.0 37.5 7.190963 70.91437 39.05267 0.5487738 2.30 0.1927052 0.30 terapeuta terapeuta
116 Vid23 piernas 84 41.5 42.0 37.823185 178.51330 108.16824 0.4496342 0.97 0.3954078 -1.87 paciente terapeuta
117 Vid24 cabeza 84 41.5 42.0 104.197333 95.18200 99.68967 0.2344671 0.00 0.2324673 5.00 terapeuta -
118 Vid24 cabeza 91 45.0 45.5 108.794704 141.42767 125.11119 0.3201068 1.57 0.2683845 -5.00 paciente terapeuta
119 Vid24 torso 83 41.0 41.5 538.777370 482.08156 510.42946 0.0163637 0.17 -0.1744114 1.27 terapeuta paciente
120 Vid24 piernas 1 0.0 0.5 266.363815 875.66615 571.01498 0.8711394 -0.90 0.6642427 -0.40 paciente terapeuta
121 Vid24 piernas 65 32.0 32.5 257.290444 109.95696 183.62370 0.6087373 3.47 0.1718748 -0.90 paciente paciente
122 Vid24 piernas 104 51.5 52.0 302.036778 132.42252 217.22965 0.4072899 -0.77 0.3044116 -0.57 paciente paciente
123 Vid25 cabeza 54 26.5 27.0 198.087481 113.81744 155.95246 0.5728097 5.00 0.0488753 4.47 terapeuta paciente
124 Vid25 piernas 30 14.5 15.0 269.003333 126.22726 197.61530 0.6522084 5.00 0.5412911 4.33 terapeuta paciente
125 Vid26 cabeza 6 2.5 3.0 253.503111 360.43207 306.96759 0.5256296 -3.43 0.1819719 -3.43 paciente terapeuta
126 Vid26 cabeza 108 53.5 54.0 139.287667 194.32185 166.80476 0.6672041 4.37 0.7043605 2.77 terapeuta terapeuta
127 Vid26 torso 6 2.5 3.0 679.454037 1581.48444 1130.46924 0.1716024 -3.43 0.1240247 -5.00 paciente terapeuta
128 Vid26 torso 108 53.5 54.0 391.547407 478.07533 434.81137 0.8221708 4.60 0.7298003 1.60 terapeuta terapeuta
129 Vid26 piernas 6 2.5 3.0 646.845185 394.59526 520.72022 0.4709075 4.60 0.4440824 3.43 terapeuta paciente
130 Vid26 piernas 20 9.5 10.0 62.806333 106.50296 84.65465 0.9350581 1.33 0.4749204 3.03 terapeuta terapeuta
131 Vid26 piernas 65 32.0 32.5 45.238444 104.86807 75.05326 0.7294289 -0.80 0.6386644 -0.93 paciente terapeuta
132 Vid26 piernas 95 47.0 47.5 199.594111 102.07259 150.83335 0.4087538 3.17 0.3029051 4.73 terapeuta paciente
133 Vid26 piernas 97 48.0 48.5 49.737593 54.47396 52.10578 0.2061339 -2.77 0.1809846 -2.37 paciente -
134 Vid26 piernas 108 53.5 54.0 244.398889 152.92341 198.66115 0.8089043 0.93 0.6793064 3.03 terapeuta paciente
135 Vid27 cabeza 1 0.0 0.5 389.652148 411.07874 400.36544 0.5084211 -3.00 0.5677212 -3.73 paciente -
136 Vid27 cabeza 2 0.5 1.0 313.600370 268.45444 291.02741 0.6068035 -2.47 0.3104478 -5.00 paciente paciente
137 Vid27 cabeza 68 33.5 34.0 77.910074 318.49530 198.20269 0.3449939 -1.43 0.4569427 -1.57 paciente terapeuta
138 Vid27 cabeza 86 42.5 43.0 99.490259 310.96278 205.22652 0.7299255 -3.57 0.4017968 -3.57 paciente terapeuta
139 Vid27 cabeza 96 47.5 48.0 317.353333 361.34719 339.35026 0.0844556 5.00 0.2896752 5.00 terapeuta terapeuta
140 Vid27 torso 1 0.0 0.5 995.640704 812.91956 904.28013 0.6928310 -0.20 0.7783093 -0.73 paciente paciente
141 Vid27 torso 2 0.5 1.0 497.982148 1500.83178 999.40696 0.5709875 -2.07 0.4958126 -2.60 paciente terapeuta
142 Vid27 torso 96 47.5 48.0 793.442852 736.74852 765.09569 0.2567863 1.83 0.2837969 2.63 terapeuta -
143 Vid27 piernas 1 0.0 0.5 1100.780370 739.85896 920.31967 0.6560199 -0.30 0.8109779 -0.43 paciente paciente
144 Vid27 piernas 2 0.5 1.0 855.337037 277.30974 566.32339 0.5901275 -2.63 0.5474072 -5.00 paciente paciente
145 Vid27 piernas 35 17.0 17.5 195.869704 102.06100 148.96535 -0.0234459 -5.00 0.4551405 3.47 terapeuta paciente
146 Vid27 piernas 41 20.0 20.5 223.899667 94.02133 158.96050 0.1635716 -1.27 0.1686909 1.47 terapeuta paciente
147 Vid27 piernas 68 33.5 34.0 225.841185 163.01204 194.42661 0.4622931 5.00 0.1400013 -4.47 paciente paciente
148 Vid27 piernas 86 42.5 43.0 308.264259 99.31274 203.78850 0.7280302 -3.83 0.2068902 -3.17 paciente paciente
149 Vid27 piernas 96 47.5 48.0 903.253519 193.15804 548.20578 0.3979453 0.00 0.5811739 0.80 terapeuta paciente
150 Vid28 cabeza 94 46.5 47.0 34.497185 300.09496 167.29607 0.5260921 -3.77 0.3833410 -3.27 paciente terapeuta
151 Vid28 cabeza 97 48.0 48.5 59.306519 123.90259 91.60456 0.5048895 4.90 0.3646434 -3.30 paciente terapeuta
152 Vid28 cabeza 98 48.5 49.0 234.658926 394.66678 314.66285 0.5691084 0.00 0.6328353 -1.30 paciente terapeuta
153 Vid28 torso 1 0.0 0.5 436.459222 260.01381 348.23652 0.6056993 -3.20 0.6342301 -5.00 paciente paciente
154 Vid28 torso 94 46.5 47.0 219.316815 521.35904 370.33793 0.5318664 -3.73 0.5396947 -3.50 paciente terapeuta
155 Vid28 torso 97 48.0 48.5 352.815000 249.59356 301.20428 0.5617831 -0.80 0.0287511 1.33 terapeuta paciente
156 Vid28 torso 98 48.5 49.0 557.576148 679.94074 618.75844 0.4833074 0.00 0.5253636 -0.37 paciente terapeuta
157 Vid28 piernas 1 0.0 0.5 406.566259 482.06978 444.31802 0.7155925 -0.13 0.6114619 -0.27 paciente terapeuta
158 Vid28 piernas 16 7.5 8.0 84.073407 60.26848 72.17094 -0.1354702 -5.00 0.0840991 -5.00 paciente paciente
159 Vid28 piernas 27 13.0 13.5 62.550407 221.12933 141.83987 -0.0329084 5.00 0.2730742 0.40 terapeuta terapeuta
160 Vid28 piernas 49 24.0 24.5 89.193333 113.17681 101.18507 0.7380981 -3.30 0.4713700 0.87 terapeuta terapeuta
161 Vid28 piernas 97 48.0 48.5 579.247296 511.56456 545.40593 0.7411675 1.40 0.6969496 0.33 terapeuta paciente
162 Vid28 piernas 98 48.5 49.0 515.881593 621.84111 568.86135 0.6500378 0.00 0.5372861 -0.47 paciente terapeuta
163 Vid29 cabeza 2 0.5 1.0 484.838000 398.06393 441.45096 0.6229316 -3.07 0.4266244 -5.00 paciente paciente
164 Vid29 cabeza 31 15.0 15.5 182.275963 90.53141 136.40369 0.6776990 0.73 0.6531886 0.33 terapeuta paciente
165 Vid29 cabeza 84 41.5 42.0 647.626444 451.34596 549.48620 0.8833251 1.67 0.5771808 1.20 terapeuta paciente
166 Vid29 torso 2 0.5 1.0 826.200704 405.96737 616.08404 0.6418154 -4.30 0.4923567 -5.00 paciente paciente
167 Vid29 torso 84 41.5 42.0 707.581852 321.31019 514.44602 0.7370317 1.10 0.4964376 1.87 terapeuta paciente
168 Vid29 piernas 2 0.5 1.0 262.217482 392.98007 327.59878 0.7856743 -4.97 0.6617232 -5.00 paciente terapeuta
169 Vid29 piernas 84 41.5 42.0 184.782222 361.31133 273.04678 0.7563810 0.87 0.6221215 1.70 terapeuta terapeuta

The functions comparativa_visual and corr_cruzadas can be used here for the segments registered in lista_mov_altos for visualization.

We illustrate this, with the ten segments with highest max correlation, and the ten segments with larger movements.

First, for the top correlations:

Segments with higher correlation
id video zona num_periodo minuto_inicio minuto_final mov_paciente mov_terapeuta mov_medio acf_max lag_acf_max spearman_max lag_spearman_max lidera se_mueve_mas
143 Vid27 piernas 1 0.0 0.5 1100.7804 739.8590 920.3197 0.6560199 -0.30 0.8109779 -0.43 paciente paciente
25 Vid7Inv piernas 37 18.0 18.5 465.7591 151.8922 308.8256 0.8166740 0.17 0.7965507 0.13 terapeuta paciente
64 Vid14 piernas 80 39.5 40.0 291.0216 2289.5888 1290.3052 0.7596830 1.60 0.7962094 1.27 terapeuta terapeuta
17 Vid6 piernas 1 0.0 0.5 483.4824 671.5927 577.5375 0.7748365 -1.43 0.7921382 0.77 terapeuta terapeuta
140 Vid27 torso 1 0.0 0.5 995.6407 812.9196 904.2801 0.6928310 -0.20 0.7783093 -0.73 paciente paciente
37 Vid9Inv piernas 1 0.0 0.5 648.7206 813.9001 731.3103 0.8021734 -1.70 0.7731040 -1.27 paciente terapeuta
87 Vid19 piernas 23 11.0 11.5 174.3834 713.6004 443.9919 0.8678707 0.00 0.7633028 -0.77 paciente terapeuta
62 Vid14 torso 80 39.5 40.0 2734.1041 6577.8507 4655.9774 0.7383573 1.37 0.7405043 -0.57 paciente terapeuta
128 Vid26 torso 108 53.5 54.0 391.5474 478.0753 434.8114 0.8221708 4.60 0.7298003 1.60 terapeuta terapeuta
105 Vid23 cabeza 1 0.0 0.5 1434.1583 770.9421 1102.5502 0.8553270 -2.23 0.7292100 -0.37 paciente paciente

And now for the segments with larger movement:

Segments with larger movement
id video zona num_periodo minuto_inicio minuto_final mov_paciente mov_terapeuta mov_medio acf_max lag_acf_max spearman_max lag_spearman_max lidera se_mueve_mas
143 Vid27 piernas 1 0.0 0.5 1100.7804 739.8590 920.3197 0.6560199 -0.30 0.8109779 -0.43 paciente paciente
25 Vid7Inv piernas 37 18.0 18.5 465.7591 151.8922 308.8256 0.8166740 0.17 0.7965507 0.13 terapeuta paciente
64 Vid14 piernas 80 39.5 40.0 291.0216 2289.5888 1290.3052 0.7596830 1.60 0.7962094 1.27 terapeuta terapeuta
17 Vid6 piernas 1 0.0 0.5 483.4824 671.5927 577.5375 0.7748365 -1.43 0.7921382 0.77 terapeuta terapeuta
140 Vid27 torso 1 0.0 0.5 995.6407 812.9196 904.2801 0.6928310 -0.20 0.7783093 -0.73 paciente paciente
37 Vid9Inv piernas 1 0.0 0.5 648.7206 813.9001 731.3103 0.8021734 -1.70 0.7731040 -1.27 paciente terapeuta
87 Vid19 piernas 23 11.0 11.5 174.3834 713.6004 443.9919 0.8678707 0.00 0.7633028 -0.77 paciente terapeuta
62 Vid14 torso 80 39.5 40.0 2734.1041 6577.8507 4655.9774 0.7383573 1.37 0.7405043 -0.57 paciente terapeuta
128 Vid26 torso 108 53.5 54.0 391.5474 478.0753 434.8114 0.8221708 4.60 0.7298003 1.60 terapeuta terapeuta
105 Vid23 cabeza 1 0.0 0.5 1434.1583 770.9421 1102.5502 0.8553270 -2.23 0.7292100 -0.37 paciente paciente